package com.yehuo.app.controller;


import com.yehuo.app.dto.APPOrderDto;
import com.yehuo.app.dto.CreateOrderDTO;
import com.yehuo.app.dto.OrderDTO;
import com.yehuo.app.model.APP;
import com.yehuo.app.service.AppOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/appOrder"})
public class AppOrderController {
    @Autowired
    private AppOrderService orderService;

    @RequestMapping({"/payOrder"})
    public APP payOrder(OrderDTO orderDTO) {
        return this.orderService.payOrder(orderDTO);
    }


    @RequestMapping({"/createOrder"})
    public APP payOrder(CreateOrderDTO orderDTO) {
        return this.orderService.createOrder(orderDTO);
    }

    @RequestMapping({"/getReceiveState"})
    public APP<Boolean> getReceiveState(String userId, String orderId) {
        return this.orderService.getReceiveState(userId, orderId);
    }

    @RequestMapping({"/getOrderDetails"})
    public APP<Object> getOrderDetails(String orderId) {
        return this.orderService.getOrderDetails(orderId);
    }

    @RequestMapping({"/select"})
    public APP selectOrder(APPOrderDto selectOrderDto) {
        return this.orderService.selectOrder(selectOrderDto);
    }

    @RequestMapping({"/updateOrder"})
    public APP updateOrder(String userId, String orderId, String note) {
        return this.orderService.updateOrder(userId, orderId, note);
    }
}
